Fix Trio imports on Android without interface helpers - #3497
Closed
mikemikimike wants to merge 1 commit into
Closed
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3497 +/- ##
===============================================
Coverage 100.00000% 100.00000%
===============================================
Files 128 128
Lines 19452 19460 +8
Branches 1321 1321
===============================================
+ Hits 19452 19460 +8
🚀 New features to boost your workflow:
|
Contributor
|
Sorry but a) I want to see what CPython will do first and b) don't use LLM generated text for PR descriptions please! (Also I think the test goes about this the wrong way and the code comment isn't helpful.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix Trio imports on Android API levels where CPython does not expose
socket.if_indextonameandsocket.if_nametoindex.Changes
if_nameindex.trio.socketwith the two standard-library helpers removed.if_indextonameandif_nametoindex#3493.Validation
PYTHONPATH=src python -m pytest src/trio/_tests/test_socket.py -q— 31 passed, 4 skipped.uv run --with 'ruff>=0.14' ruff check src/trio/socket.py src/trio/_tests/test_socket.py— passed.python -m black --check src/trio/socket.py src/trio/_tests/test_socket.py— passed.uv run --with 'mypy>=1.18' mypy src/trio/socket.py— passed.uv run --with build --with setuptools python -m build --wheel --no-isolation— passed.git diff --check— passed.The repository's system Ruff 0.15.0 cannot parse the current configuration's newer
builtin-argument-shadowingselector, so the compatible Ruff version was supplied throughuv. Type checking the whole test module with--follow-imports=skipreports pre-existing test/decorator and ignored-import diagnostics; the changed production module passes mypy.Compatibility
On platforms that provide these functions, Trio continues to re-export them unchanged. On platforms that do not, importing
trio.socketsucceeds and the unavailable names are simply absent, consistent with existing platform-specific exports.Fixes #3493.